]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
viewSelector: Send first printable keystroke to the search entry
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 22 Dec 2017 11:30:11 +0000 (12:30 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 5 Feb 2018 16:46:57 +0000 (17:46 +0100)
StIMText used to handle key events for IM consumption in the capture phase,
this made the search box work automagically with nothing explicitly focusing
it. Since it's no longer the case, it has to be done somewhere.

js/ui/viewSelector.js

index 7131f77bdb1798a88945152374d1c1c325513bec..d9a13a3aa372554582b402996a01bf20cd4197a7 100644 (file)
@@ -606,6 +606,15 @@ var ViewSelector = new Lang.Class({
                 // - cancel the search
                 this.reset();
             }
+        } else if (!this._text.has_key_focus() &&
+                   (event.type() == Clutter.EventType.KEY_PRESS ||
+                    event.type() == Clutter.EventType.KEY_RELEASE)) {
+            let unichar = event.get_key_unicode();
+
+            if (GLib.unichar_isprint(unichar)) {
+                this._text.grab_key_focus();
+                return this._text.event(event, false);
+            }
         }
 
         return Clutter.EVENT_PROPAGATE;